package cn.lg.soar.system.biz.modules.auth.entity;

import cn.lg.soar.database.base.entity.ITenantEntity;
import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Getter;
import lombok.Setter;

import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.Objects;

/**
 * @author luguoxiang
 * 开源项目：https://gitee.com/lgx1992/lg-soar 求star！请给我star！请帮我点个star！
 */
@Getter
@Setter
@TableName("lg_sys_menu_2_permit")
public class MenuPermitRel implements ITenantEntity, Serializable {

    private static final long serialVersionUID = -1866910069768203069L;

    @TableId(type = IdType.NONE)
    private Integer menuId;

    private Integer permitId;

    @TableField(fill = FieldFill.INSERT)
    protected LocalDateTime createTime;

    @TableField(fill = FieldFill.INSERT)
    private Long createBy;

    @JsonIgnore
    @TableField(select = false)
    private Integer tenantId;

    @Override
    public boolean equals(Object o) {
        if (o == null || getClass() != o.getClass()) return false;
        MenuPermitRel that = (MenuPermitRel) o;
        return Objects.equals(menuId, that.menuId) && Objects.equals(permitId, that.permitId);
    }

    @Override
    public int hashCode() {
        return Objects.hash(menuId, permitId);
    }
}
